Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for lambda not evaluating some environment variables #42

Merged
merged 1 commit into from
Apr 10, 2023

Conversation

rupal-bq
Copy link
Contributor

Description

  • Updated condition while setting default values for lambda event.
  • Test this fix with updated docker image on lambda

Issues Resolved

#38

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Rupal Mahajan <maharup@amazon.com>
@rupal-bq rupal-bq added bug Something isn't working v1.1.0 labels Apr 10, 2023
@rupal-bq rupal-bq requested a review from a team as a code owner April 10, 2023 21:02
@rupal-bq rupal-bq self-assigned this Apr 10, 2023
event['subject'] = DEFAULT_EMAIL_SUBJECT;
if (event.note === undefined)
if (event.note === undefined && process.env[ENV_VAR.EMAIL_NOTE] === undefined)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works but seems backwards, it's easy to miss since the code is checking process.env[ENV_VAR.EMAIL_NOTE] in both getOptions and getEventArguments. e.g. if a config file is introduced later, this needs to also check && config_file.email_note === undefined

i think peter brought this up before, it might be better to have a default options object in getOptions. If there are any explicitly defined configs, overwrite the value with the highest priority config (command arguments > environment variables), or overwrite multiple times starting from lowest priority

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. will need check how to set default options object though because currently for cli options object is created with commander program, even setting env var is happening at that time for cli https://github.com/opensearch-project/reporting-cli/blob/main/src/arguments.js#L24 and want to keep main logic same for cli/lambda/package. getOptions is setting environment variable only for lambda & credentials as it has :. Anyway will add this also to refactor issue and try to prioritize.

@rupal-bq rupal-bq mentioned this pull request Apr 10, 2023
@rupal-bq rupal-bq merged commit 735bf67 into opensearch-project:main Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v1.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants